<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('parter/index')}">党员风采</a></li>
        <li class="active"><a href="{:url('parter/edit')}">编辑</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('parter/editPost')}">
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">标题<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="name" value="{$result.name}">
            </div>
        </div>
	

		<div class="form-group">
			<label for="" class="col-sm-2 control-label"><span class="form-required"></span>党内职务</label>
			<div class="col-md-3 col-sm-5">
				<select class="form-control" name="partypost" id="" style="width:300px;">
					<volist name="partypost" id="v">
						<option value="{$v.id}" <if condition="$v['id'] eq $result['partypost']"> selected </if>>{$v.name}</option>
					</volist>
				</select>
			</div>
		</div>		
		<div class="form-group">
			<label for="" class="col-sm-2 control-label"><span class="form-required"></span>党支部</label>
			<div class="col-md-3 col-sm-5">
				<select class="form-control" name="partybranch" id="" style="width:300px;">
					<volist name="partybranch" id="v">
						<option value="{$v.id}" <if condition="$v['id'] eq $result['partybranch']"> selected </if>>{$v.name}</option>
					</volist>
				</select>
			</div>
		</div>			
		
		<div class="form-group">
			<label for="thumbnail" class="col-sm-2 control-label"><span class="form-required">*</span>图片</label>
			<div class="col-md-6 col-sm-10">
				<input type="hidden" name="thumb" id="thumbnail"  value="{$result.thumb}">
				<a href="javascript:uploadOneImage('图片上传','#thumbnail');">
					<if condition="$result['thumb'] neq ''">
						<img src="{:get_upload_path($result['thumb'])}"
							 id="thumbnail-preview"
							 style="cursor: pointer;max-width:100px;max-height:100px;"/>					
					<else />
						<img src="__TMPL__/public/assets/images/default-thumbnail.png"
							 id="thumbnail-preview"
							 style="cursor: pointer;max-width:100px;max-height:100px;"/>					
					</if>

				</a>
				<input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片"> 
			</div>
		</div>		

		<div class="form-group">
			<label for="input-giftname" class="col-sm-2 control-label"><span class="form-required">*</span>内容</label>
			<div class="col-md-6 col-sm-10">
				<textarea style="width: 100%;height: 150px;" name="content">{$result.content}</textarea>
			</div>
		</div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" class="form-control" name="id" value="{$result.id}">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
                <a class="btn btn-default" href="{:url('parter/index')}">{:lang('BACK')}</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
	//编辑器路径定义
	var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>

<script type="text/javascript">

	$(function () {
		editorcontent = new baidu.editor.ui.Editor();
		editorcontent.render('content');
		try {
			editorcontent.sync();
		} catch (err) {
		}

		$('#more-template-select').val("{$post.more.template|default=''}");
	});


	var map;
	// 点击开启定位时显示地图
	$("input[name='is_location']").click(function () {
		if (this.value === '1') {
			$(".check-location").show();
			init();
		}
	});

	//点击关闭定位时移除地图元素
	$("#close-location").click(function () {
		$(".check-location").hide();
		$('#mapContainer').children().remove();
	});
	$(".btn-cancel-thumbnail").click(function(){
		$("#thumbnail-preview").attr('src','__TMPL__/public/assets/images/default-thumbnail.png');
		$("#thumbnail").val('');
	});






</script>
</body>
</html>